package zxs.sino.elite.hub.controller;

import java.util.Arrays;
import java.util.Map;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zxs.sino.elite.hub.model.app.LoginLogEntity;
import zxs.sino.elite.hub.service.app.LoginLogService;
import zxs.sino.elite.hub.utils.PageUtil;
import zxs.sino.elite.hub.utils.R;



/**
 * 登录日志表
 *
 * @author zhang
 * @email 15824760766@163.com
 * @date 2025-09-02 20:23:52
 */
@RestController
@RequestMapping("loginlog")
@RequiredArgsConstructor
public class LoginLogController {

    private final  LoginLogService loginLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtil page = loginLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{logId}")
    public R info(@PathVariable("logId") Long logId){
		LoginLogEntity loginLog = loginLogService.getById(logId);

        return R.ok().put("loginLog", loginLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody LoginLogEntity loginLog){
		loginLogService.save(loginLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody LoginLogEntity loginLog){
		loginLogService.updateById(loginLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] logIds){
		loginLogService.removeByIds(Arrays.asList(logIds));

        return R.ok();
    }

}
